package com.itheima.hmshopping.app.controller;

import com.itheima.hmshopping.app.service.SmsCouponHistoryService;
import com.itheima.hmshopping.util.HmPage;
import com.itheima.hmshopping.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("couponHistory")
public class SmsCouponHistoryController {
    @Autowired
    private SmsCouponHistoryService smsCouponHistoryService;

    //根据优惠券id，使用状态，订单编号分页获取领取记录
    @GetMapping("list")
    public R list(Integer couponId, String orderSn,
                  @RequestParam(defaultValue = "1")Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize,
                  Integer useStatus){
        HmPage hmPage=smsCouponHistoryService.list(couponId,orderSn,pageNum,pageSize,useStatus);
        return R.succeed(hmPage,"ok");
    }
}
